
public class HoleBurialFeature implements Feature {
	// compute the cost of burying the highest hole
	
	@Override
	public double computeScore(Stateview s) {
		int[] top = s.getTop();
		int[][] field = s.getField();
		int cost = -1;
		int nearest_hole_depth = 0;
		int nearest_hole_row = 0;
		
		// compute the size of holes
		for(int col=0; col<Stateview.COLS; col++) {
			int depth = 1;
			// start from the second highest row in the current column
			for(int row=top[col]-2; row>=0; row--) {
				if(field[row][col] == 0){
					if(nearest_hole_row < row) {
						nearest_hole_row = row;
						nearest_hole_depth = depth;
					}
					break; // go to the next column
				}
				depth++; 
			}
		}
		//System.out.println("max depth " + nearest_hole_depth);
		// TODO Auto-generated method stub
		return nearest_hole_depth*-1;
	}
	

}
